body {
display: grid;
place-items: center;
height: 100vh;
background: #151515;
color: white;
font-family: sans-serif;
font-size: 1.2rem;
}
.wrapper {
display: flex;
align-items: center;
}
input[type=radio] {
display: none;
}
label {
position: relative;
margin-right: 1em;
padding-left: 2em;
padding-right: 1em;
line-height: 2;
cursor: pointer;
}
label:before {
box-sizing: border-box;
content: " ";
position: absolute;
top: 0.3em;
left: 0;
display: block;
width: 1.4em;
height: 1.4em;
border: 2px solid white;
border-radius: 0.25em;
z-index: -1;
}
input[type=radio]+label::before {
border-radius: 1em;
}
/* Checked */
input[type=radio]:checked+label {
padding-left: 1em;
color: #151515;
}
input[type=radio]:checked+label:before {
top: 0;
width: 100%;
height: 2em;
background: white;
}
/* Transition */
label,
label::before {
transition: 0.25s all ease;
}